import { defineStore } from "pinia";
import {computed, ref} from 'vue'
// 选项式的
export const useInfoStore2 = defineStore('info2', ()=>{
  let birth = ref('1992-02-16')
  let age = ref(30)

  // 通过computed 获得计算的属性 只读 通过依赖的数据改变
  let birthMonth = computed(()=>{
    return birth.value.split('-')[1]
  })
  let ageState = computed(()=>{
    if(age.value > 18){
      return '成年人';
    }else{
      return '未成年';
    }
  })
  return {birth,age,birthMonth,ageState}
})

